<template>
  <div class="itemContent" @click="toStore">
    <div class="left">
      <img :src="itemContent.pic" alt="" />
    </div>
    <div class="right">
      <div class="title">{{ itemContent.title }}</div>
      <div class="sales">{{ itemContent.sales }}</div>
      <div class="price">{{ itemContent.price }}</div>
      <div class="label">
        <div v-for="(item, index) in itemContent.label" :key="index">
          {{ item }}
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
const router = useRouter();
defineProps(["itemContent"]);
function toStore() {
  router.push("/store");
}
</script>

<style lang="less" scoped>
.itemContent {
  display: flex;

  background-color: #fff;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 5px;
  .left {
    display: flex;
    align-items: center;
    margin-right: 15px;
    img {
      width: 130px;
      height: 130px;
      border-radius: 10px;
    }
  }
  .right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .title {
      font-size: 16px;
      font-weight: bold;
    }
    .sales,
    .price {
      font-size: 14px;
    }
    .label {
      display: flex;
      div {
        font-size: 12px;
        background: #ffc400;
        border-radius: 5px;
        padding: 0 3px;
      }
      div:not(:first-child) {
        margin-left: 5px;
      }
    }
  }
}
</style>
